1
var element = angular.element($document.getElementById("app"));
var controller = element.controller();
var scope = element.scope();
//调用方法
scope.sub1();

//如果需要重新绑定
scope.$apply();

//调用字段
scope.field1;

http://stackoverflow.com/ques...

angular.element(domElement).scope() to get the current scope for the element
angular.element(domElement).injector() to get the current app injector
angular.element(domElement).controller() to get a hold of the ng-controller instance.


Chobits
7.4k 声望171 粉丝

保卫骡博 Chobits#3780